<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>易商金融车贷贷前信息管理系统--易商贷前系统</title>
<link rel="stylesheet" type="text/css" href="<?php echo BASE_STYLE;?>/css/index.css" />
<link rel="stylesheet" type="text/css" href="<?php echo BASE_STYLE;?>/css/admin.css" />

<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/jquery.form.js"></script>
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/dyhl.form.js"></script>

</head>

<body class="login-bg">

<div class="password-box">
    <form class="password-box-form J-ajaxForm" action="/auth/getpwd/option/submit" method="post" autocomplete="off">
    	<dl class="password-box-dl">
        	<dd class="mt15">
                <input type="text" class="J-username" name="u_name" />
                <span class="J-tel-txt"></span>
            </dd>
            <dd class="mt10">
                <input type="text" name="u_code" style="width:96px;" class="mr5 J-password" />
                <input type="button" onClick="sendMessage()" class="J-getcode" style="width:95px; background:none; border:0; color:#FFF; text-align:center;" value="获取验证码" />
                <span></span>
            </dd>
            <dd class="mt15">
                <input type="password" name="u_repassword" class="J-password" />
                <span class="J-password-txt"></span>
            </dd>
            <dd class="mt5">
            	<input type="submit" class="J-submit" value="" style="width:100px; height:35px; cursor:pointer; background:none; border:none;" />
                <a href="/" style="position:relative; top:-5px; text-decoration:underline;">去登陆</a>
            </dd>
        </dl>
    </form>
</div>
<script type="text/javascript">
	$(document).ready(function(e) {
        $(".J-submit").on('click',function(){
			$(this).dyhlForm({
				beforefunction:function(){
					$(".J-submit").prop('disabled',true);
				},
				nofunction:function(){
					$(".J-submit").prop('disabled',false);
				},
				sucessfunction:function(data){
					$(".J-submit").prop('disabled',false);
					if(data['success']){
						alert(data['msg']);
						//Ext.Msg.alert('提示','提交成功');
						window.location.reload();
					}else{
						alert(data['msg']);
						//Ext.Msg.alert('提示',data['msg']);
					}
				}	
			});	
		});
    });
</script>
<script type="text/javascript">
/*-------------------------------------------*/
var InterValObj; //timer变量，控制时间
var count = 60; //间隔函数，1秒执行
var curCount;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
function sendMessage() {
	curCount = count;
	var phone=$(".J-username").val();//手机号码
	if(phone != ""){
		
		jQuery(".J-getcode").attr("disabled", "true");
		jQuery(".J-getcode").val(curCount + "秒后重新获取");
		InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
		
		$.post('/public/ajax/option/sendsms/',{'mobile':phone},function(data){
			if(data.success){
				return false
			}else{
				alert(data.msg);
				//Ext.Msg.alert('提示',data['msg']);
			}
		},'json');
	}else{
		alert("手机号码不能为空！");
		//Ext.Msg.alert('提示','手机号码不能为空');
	}
}
//timer处理函数
function SetRemainTime() {
	if (curCount == 0) {                
		window.clearInterval(InterValObj);//停止计时器
		jQuery(".J-getcode").removeAttr("disabled");//启用按钮
		jQuery(".J-getcode").val("重新发送验证码");
		code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
	}
	else {
		curCount--;
		jQuery(".J-getcode").val(curCount + "秒后重新获取");
	}
}
</script>
</body>
</html>
